package com.cloudbroker.bcs.platform.ltb.common.config;

import com.cloudbroker.bcs.common.configure.ConfigUtil;
import com.cloudbroker.bcs.common.util.StringUtil;

public class ConfigValues {

    /**
     * 默认每页请求行数
     */
    public static final int REQUEST_NUM = 10;

    /**
     * 默认会话超时时间（秒）
     */
    public static final int SESSION_TIMEOUT = 10 * 60;

    /**
     *
     */
    public static final int LEADER_TIME=24*60*60000;

    /**
     * 租户ID宽度
     */
    public static final int TENANT_ID_WIDTH = 4;
    
    /**
     * 默认ID序列号宽度
     */
    public static final int ID_SEQ_WIDTH = 10;
    
    /**
     * 默认ID序列号尝试获得次数（由于并发而失败）
     */
    public static final int ID_SEQ_GEN_TRIES = 3;
    
    /**
     * 默认密码长度
     */
    public static final int DEFAULT_PWD_LENGTH = 6;
    
    /**
     * 验证码重试次数
     */
    public static final int VERIFY_CODE_RETRY_TIMES = 5;
    
    /**
     * 验证码长度
     */
    public static final int VERIFY_CODE_LENGTH = 6;
    
    /**
     * 邀请码长度
     */
    public static final int INVITATION_CODE_LENGTH = 6;
    
    /**
     * 验证码超时时间（秒）
     */
    public static final int VERIFY_CODE_TIMEOUT = 2 * 60;
    
    /**
     * 密码盐值长度
     */
    public static final int PWD_SALT_LENGTH = 32;
    
    /**
     * 付费观点默认显示字数
     */
    public static final int PAYREAD_VIEWPOINT_SHOW = 40;
    
    /**
     * 显示在线用户数开关
     */
    public static final int ONLINE_NUM_SHOW_FLAG = 1;
    /**
     * 显示在线用户数阈值
     */
    public static final int ONLINE_NUM_SHOW_THRESHOLD = 100;
    
    public static final String YUNXIN_APP_KEY = "11869807ac7ba398891434c33e8e9e3a";
    public static final String YUNXIN_APP_SECRET = "8b2384420fa5";
    public static final String YUNXIN_NONCE = "12345";
    
    public static final String[] DEFAULT_VIEWPOINT_TAG = { "行情", "付费", "资讯", "观点" };
    
    /**
     * 微信配置信息
     */
    public static final String WEIXIN_APP_KEY = "wxaedbfa0dd03a2b26";
    public static final String WEIXIN_APP_SECRET = "c410103b31f67fb55b859a14a52ffb13";
    public static final String MCH_ID = "1322680501";
    public static final String NOTIFY_URL = "http://120.27.166.214/func_pay_callback";
    
    /**
     * 微博配置信息 
     */
    public static final String WEIBO_APP_KEY = "1442812672";
    public static final String WEIBO_APP_SECRET = "4111d10d716bc1d0a773d90299c1fbf8";
    public static final String WEIBO_REDIRECT_URI = "http://fensiuat.yjifs.com/webroot/greatV/?oauth_provider=SinaProvider";
    

    /**
     * QQ配置信息 
     */
    public static final String QQ_APP_KEY = "1105436568";
    public static final String QQ_APP_SECRET = "xvSGiXqj7yRjwb5o";
    public static final String QQ_REDIRECT_URI = "http%3a%2f%2ffensiuat.yjifs.com%2fwebroot%2fgreatV%2f%3foauth_provider%3dSinaProvider";
    
    /**
     * 获取会话超时时间（秒）
     * 
     * @return
     */
    public static int getSessionTimeout() {
        return ConfigUtil.getInt("func.session.timeout", SESSION_TIMEOUT);
    }
    
    /**
     * 邀请码长度
     * 
     * @return
     */
    public static int getInviteCodeLength() {
        return ConfigUtil.getInt("func_Invitecode_length", INVITATION_CODE_LENGTH);
    }
    
    /**
     * 邀请码数据字段
     * 
     * @return
     */
    public static String getInviteCodeDit() {
        return ConfigUtil.get("func_Invitecode_dict");
    }
    
    /**
     * 验证码长度
     * 
     * @return
     */
    public static int getVerifyCodeLength() {
        return ConfigUtil.getInt("func.verifycode.length", VERIFY_CODE_LENGTH);
    }
    
    /**
     * 验证码重试次数
     * 
     * @return
     */
    public static int getVerifyCodeRetryTimes() {
        return ConfigUtil.getInt("func.verifycode.retry.times", VERIFY_CODE_RETRY_TIMES);
    }
    
    /**
     * 验证码超时时间（秒）
     * 
     * @return
     */
    public static int getVerifyCodeTimeout() {
        return ConfigUtil.getInt("func.verifycode.timeout", VERIFY_CODE_TIMEOUT);
    }
    
    /**
     * 中台REST服务基路径（内网/局域网）
     * 
     * @return
     */
    public static String getAPIRestUrlBaseLan() {
        return ConfigUtil.get("hsbcps.api.rest.urlBase.lan");
    }
    
    /**
     * 中台REST服务基路径（外网/广域网）
     * 
     * @return
     */
    public static String getAPIRestUrlBaseWan() {
        return ConfigUtil.get("hsbcps.api.rest.urlBase.wan");
    }
    
    /**
     * 获取ID序列号尝试获得次数（由于并发而失败）
     * 
     * @return
     */
    public static int getIdSeqGenTries() {
        return ConfigUtil.getInt("func.idseq.gen.tries", ID_SEQ_GEN_TRIES);
    }
    
    /**
     * 获取使用超级验证码开关
     * 
     * @return
     */
    public static boolean getVerifyCodeSuperSwitch() {
        return ConfigUtil.getBoolean("func.verifycode.super.swich", false);
    }
    
    /**
     * 获取超级验证码
     * 
     * @return
     */
    public static String getVerifyCodeSuperValue() {
        return ConfigUtil.getString("func.verifycode.super.value");
    }
    
    /**
     * 获取缓存实现类型
     * 
     * @return
     */
    public static String getCacheImplType() {
        return ConfigUtil.getString("cache.implType");
    }
    
    /**
     * itn.lock.flag 默认为1
     * 
     * @return
     */
    public static int getLockFlag() {
        return ConfigUtil.get("itn.lock.flag", 1);
    }
    
    /**
     * itn.businsys.no 默认为1002
     * 
     * @return
     */
    public static long getBusinsysNo() {
        return ConfigUtil.get("itn.businsys.no", 1002);
    }
    
    /**
     * itn配置信息获取
     * 
     * @return
     */
    public static boolean getItnregistrTokenSwich() {
        return ConfigUtil.getBoolean("itn.register.token.swich", false);
    }
    
    /**
     * 活动规则配置信息获取
     * 
     * @return
     */
    public static boolean getActivityRule() {
        return ConfigUtil.getBoolean("activity.qx.team.rule", false);
    }
    
    /**
     * 获取短信实现类型
     * 
     * @return
     */
    public static String getSMSImpl() {
        return ConfigUtil.getString("sms.impl");
    }
    
    public static String getStoreImplType() {
        return ConfigUtil.getString("store.implType");
    }
    
    public static String getStoreFilePath() {
        return ConfigUtil.getString("store.file.path");
    }
    
    public static String getOSSInnerDomain() {
        return ConfigUtil.getString("store.oss.innerDomain");
    }
    
    public static String getOSSAccessId() {
        return ConfigUtil.getString("store.oss.accessKey");
    }
    
    public static String getOSSAccessKey() {
        return ConfigUtil.getString("store.oss.accessSecret");
    }
    
    public static String getOSSBucketName() {
        return ConfigUtil.getString("store.oss.bucketName");
    }
    
    public static String getOSSDebug() {
        return ConfigUtil.getString("store.oss.debug");
    }
    
    public static String getInterfaceUagAddr() {
        return ConfigUtil.getString("interface.uag.addr");
    }
    
    public static String getInterfaceOssAddr() {
        String address = ConfigUtil.getString("interface.oss.addr");
        if (!address.endsWith("/")) {
            address += "/";
        }
        return address;
    }
    
    public static String getDownloadIgnoreCheckFilename() {
        return ConfigUtil.get("download.ignore.check.filename", "");
    }
    
    public static String getYunxinAppkey() {
        return ConfigUtil.getString("yunxin.app_key", YUNXIN_APP_KEY);
    }
    
    public static String getYunxinAppSecret() {
        return ConfigUtil.getString("yunxin.app_secret", YUNXIN_APP_SECRET);
    }
    
    public static String getYunxinNonce() {
        return ConfigUtil.getString("yunxin.nonce", YUNXIN_NONCE);
    }
    
    public static String getSmsOwnCompanyId() {
        return ConfigUtil.getString("sms.own.company.id");
    }
    
    public static String getSmsCompanyId() {
        return ConfigUtil.getString("sms.company.id");
    }
    
    public static String getSmsBusinsysNo() {
        return ConfigUtil.getString("sms.businsys.no");
    }
    
    public static String getSmsAuthKey() {
        return ConfigUtil.getString("sms.authkey");
    }
    
    public static String getMailImpl() {
        return ConfigUtil.getString("mail.impl");
    }
    
    public static String getSMSSvcUrl() {
        return ConfigUtil.getString("sms.svc.url");
    }
    
    public static String getMailSvcUrl() {
        return ConfigUtil.getString("mail.svc.url");
    }
    
    public static int getSmsSendCountDown() {
        return ConfigUtil.get("func.verifycode.send.count.down", 60);
    }
    
    public static String getRegCheckAccount() {
        return ConfigUtil.get("func_reg_check_account", "account");
    }
    
    public static String getRegCheckPassword() {
        return ConfigUtil.get("func_reg_check_password", "password");
    }
    
    /**
     * 超时时间内验证次数
     *
     * @return
     */
    public static int getVerifyCodeTimesInOutTime() {
        return ConfigUtil.getInt("func.verifycode.time", VERIFY_CODE_RETRY_TIMES);
    }
    
    /**
     * 验证码超时时间（秒）
     * @return
     */
    public static int getMobileVerifyCodeTimeout() {
        return ConfigUtil.getInt("func_mobile_verifycode_time_out", VERIFY_CODE_TIMEOUT);
    }
    
    /**
     * 每页请求行数
     * @return
     */
    public static int getRequestNum() {
        return ConfigUtil.getInt("func_request_num", REQUEST_NUM);
    }
    
    /**
     * 付费观点默认显示字数
     * @return
     */
    public static int getPayReadViewpointShow() {
        return ConfigUtil.getInt("func_payread_viewpoint_show", PAYREAD_VIEWPOINT_SHOW);
    }
    
    public static String[] getDefaultViewpointTag() {
        String tagstr = ConfigUtil.get("func_default_viewpoint_tag");
        if (StringUtil.isEmpty(tagstr)) {
            return DEFAULT_VIEWPOINT_TAG;
        }
        return tagstr.split(",");
    }


    /**
     * 粉丝端链接地址配置
     * @return
     */
    public static String getFansWebUrlDomain() {
        return ConfigUtil.getString("func_fans_web_domain", "http://127.0.0.1:21600/");
    }
    /**
     * 验证码超时时间（秒）
     * @return
     */
    public static int getImgVerifyCodeTimeout() {
        return ConfigUtil.getInt("func.img.verifycode.timeout", VERIFY_CODE_TIMEOUT);
    }
    
    public static String getNotifyUrl() {
        return ConfigUtil.getString("wx.notify.url", NOTIFY_URL);
    }
    
    public static String getWeixinAppKey() {
        return ConfigUtil.getString("wx.app.key", WEIXIN_APP_KEY);
    }
    
    public static String getWeixinAppSecret() {
        return ConfigUtil.getString("wx.app.secret", WEIXIN_APP_SECRET);
    }
    
    public static String getMchId() {
        return ConfigUtil.getString("weixin.mch_id", MCH_ID);
    }
    
    public static String getTongLianId() {
        return ConfigUtil.getString("tonglian.id");
    }
    
    public static String getTongLianKey() {
        return ConfigUtil.getString("tonglian.key");
    }
    
    public static String getTongLianCID() {
        return ConfigUtil.getString("tonglian.cusid");
    }
    
    public static boolean getMycatFlag() {
        return ConfigUtil.getBoolean("func_mycat_flag", false);
    }

    public static Integer getMycatNum() {
        return ConfigUtil.getInt("func_mycat_num" , 4);
    }

    public static boolean getMybatisCacheFlag() {
        return ConfigUtil.getBoolean("func_mybatis_cache_flag", false);
    }
    
    public static class ClientMessage {
        
        public static String getSendRegisterVerifyCodeMessage(Object... vars) {
            return ConfigUtil.getWithFormat("clientmsg.verifyCode.register", vars);
        }
        
        public static String getSendSetPwdVerifyCodeMessage(Object... vars) {
            return ConfigUtil.getWithFormat("clientmsg.verifyCode.set.pwd", vars);
        }
        
        public static String getSendUpdateMobileVerifyCodeMessage(Object... vars) {
            return ConfigUtil.getWithFormat("clientmsg.verifyCode.update.login_account", vars);
        }
        
        public static String getSendTransactionVerifyCodeMessage(Object... vars) {
            return ConfigUtil.getWithFormat("clientmsg.verifyCode.transaction", vars);
        }
        
        public static String getSendPrizeSNVerifyCodeMessage(Object... vars) {
            return ConfigUtil.getWithFormat("clientmsg.verifyCode.prizeSN", vars);
        }
        
        public static String getSendInviteCodeVerifyCodeMessage(Object... vars) {
            return ConfigUtil.getWithFormat("clientmsg.verifyCode.inviteCode", vars);
        }
        
        public static String getSendExpressInfoVerifyCodeMessage(Object... vars) {
            return ConfigUtil.getWithFormat("clientmsg.verifyCode.expressInfo", vars);
        }
        
        public static String getSendLoginVerifyCodeMessage(Object... vars) {
            return ConfigUtil.getWithFormat("clientmsg.verifyCode.login", vars);
        }
    }
    
    public static String getWeiboAppKey() {
        return ConfigUtil.getString("weibo_client_id", WEIBO_APP_KEY);
    }
    
    public static String getWeiboAppSecret() {
        return ConfigUtil.getString("weibo_client_secret", WEIBO_APP_SECRET);
    }
    
    public static String getWeiboRedirectUri() {
        return ConfigUtil.getString("weibo_redirect_uri", WEIBO_REDIRECT_URI);
    }
    
    public static String getQQAppKey() {
        return ConfigUtil.getString("qq_client_id", QQ_APP_KEY);
    }
    
    public static String getQQAppSecret() {
        return ConfigUtil.getString("qq_client_secret", QQ_APP_SECRET);
    }
    
    public static String getQQRedirectUri() {
        return ConfigUtil.getString("qq_redirect_uri", QQ_REDIRECT_URI);
    }

    public static int getLeaderUpdateTime(){
        return ConfigUtil.getInt("func_leader_info_update_time",LEADER_TIME);
    }
}
